<template>
<h2>我叫{{name}},今年25岁</h2>
</template>
<script>
export default {
  name: "DetailView",
  data() {
    return {name: ""}
  },
  mounted() {
    //mounted是vue生命周期方法,当组件挂载完成时会自动触发,
    // 将组件挂载完成就立即执行的代码写在此处
    //从地址栏中得到name   location.search得到地址栏中 ?name=李四&age=18
    this.name = new URLSearchParams(location.search).get("name");
  }
}
</script>

<style scoped>

</style>